<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="css/fangkejilu.css"/>

</head>
<body >
<div id="div1">
    <table class="dataintable">
        <tr>
            <td>到访时间</td>
            <td>到访宿舍</td>
            <td>到访原因</td>
            <td>离开时间</td>
            <td>操作</td>
        </tr>
        <c:forEach var="list" items="${sessionScope.list}">
            <tr>
                <td>${list.vst_ctime}</td>
                <td>${list.dor_no}</td>
                <td>${list.vst_reson}</td>
                <td>${list.vst_ltime}</td>
                <td>
                    <button type="button" onclick="del(${list.vst_id})">删除</button>
                </td>
            </tr>
        </c:forEach>
    </table>
</div>
<div id="foot">


    <c:if test="${sessionScope.pageIndex==1}">
        首页
        上一页
    </c:if>
    <c:if test="${sessionScope.pageIndex>1}">
        <a href="${pageContext.request.contextPath}/VisitQueryServlet.do?pageIndex=1">首页</a>
        <a href="${pageContext.request.contextPath}/VisitQueryServlet.do?pageIndex=${sessionScope.pageIndex-1}">上一页</a>
    </c:if>
    ${sessionScope.pageIndex}/${sessionScope.pageNum}
    <c:if test="${sessionScope.pageIndex<sessionScope.pageNum}">
        <a href="${pageContext.request.contextPath}/VisitQueryServlet.do?pageIndex=${sessionScope.pageIndex+1}">下一页</a>
        <a href="${pageContext.request.contextPath}/VisitQueryServlet.do?pageIndex=${sessionScope.pageNum}">尾页</a>
    </c:if>
    <c:if test="${sessionScope.pageIndex==sessionScope.pageNum}">
        下一页
        尾页
    </c:if>
</div>
<div id="div2">
    <br>
    <br>
    <br>
    <button type="button" onclick="daochu()">导出文件</button>
</div>

</body>
<script>
    function del(n){
        if(confirm("确认删除吗")){
            location.href="${pageContext.request.contextPath}/DelVisitServlet.do?vst_id="+n;
        }
        else{
            alert("no")
            return;
        }
    }
    function daochu() {
        location.href="${pageContext.request.contextPath}/DChServlet.do";
    }
</script>
</html>

